package com.lightkits.wms.controller;

import com.lightkits.wms.domain.saveonhand.QueryInventoryOnhandExecutor;
import com.lightkits.wms.domain.saveonhand.SaveOnhandExecutor;
import com.lightkits.wms.dto.onhand.QueryInventoryOnhandRequestType;
import com.lightkits.wms.dto.onhand.QueryInventoryOnhandResponseType;
import com.lightkits.wms.dto.onhand.SaveOnhandRequestType;
import com.lightkits.wms.dto.onhand.SaveOnhandResponseType;
import io.choerodon.swagger.annotation.Permission;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * SaveOnhandController
 *
 * @author jing.wei@hand-china.com
 * Created on 2019/5/21 14:52
 */
@RestController
@RequestMapping("/OnhandService")
public class SaveOnhandController {

    @PostMapping(value = "/saveOnhand")
    @Permission(permissionPublic = true)
    @ApiOperation(value = "/saveonhand")
    @ResponseBody
    public SaveOnhandResponseType saveOnhand(@RequestBody(required = false) SaveOnhandRequestType request) {
        return saveOnhandExecutor.service(request);
    }

    @Autowired
    private SaveOnhandExecutor saveOnhandExecutor;

    @PostMapping(value = "/queryInventoryOnhandQuantity")
    @Permission(permissionPublic = true)
    @ApiOperation(value = "/queryInventoryOnhandQuantity")
    @ResponseBody
    public QueryInventoryOnhandResponseType queryInventoryOnhandQuantity(@RequestBody(required = false) QueryInventoryOnhandRequestType request) {
        return queryInventoryOnhandExecutor.service(request);
    }

    @Autowired
    private QueryInventoryOnhandExecutor queryInventoryOnhandExecutor;
}
